<?php


namespace backend\components;


trait ResponseJson
{
    /**
     * 输出Json
     * @param array $data
     * @return array
     */
    protected function jsonOutput($data = [])
    {
        $output = [
            'status' => '00',
            'data' => $data,
            'msg' => '操作成功!'
        ];
//        $output = array_merge($output, $data);
        return $this->asJson($output);
    }


    protected function jsonErr($message)
    {
        $output = [
            'status'=>'400',
            'data'=>[],
            'msg'=>$message
        ];
        return $this->asJson($output);
    }
}